<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head th:include="admin/head :: head" th:with="title=版本控制编辑">
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <form class="layui-form" action="" lay-filter="formfilter">
                <div class="layui-form-item">
                    <label class="layui-form-label"><span style="color: red">*</span>安卓版本号:</label>
                    <div class="layui-input-block">
                            <input type="text" id="androidVersion" name="androidVersion" lay-verify="required|androidVersion" autocomplete="off"  class="layui-input" th:value="${ m.androidVersion}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><span style="color: red">*</span>下载地址:</label>
                    <div class="layui-input-block">
                            <input type="text" id="androidAddress" name="androidAddress" lay-verify="required|androidAddress" autocomplete="off"  class="layui-input" th:value="${ m.androidAddress}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><span style="color: red">*</span>更新内容:</label>
                    <div class="layui-input-block">
                        <textarea id="androidInfo" name="androidInfo" lay-verify="required|androidInfo"  class="layui-textarea" th:text="${ m.androidInfo}"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><span style="color: red">*</span>IOS版本号:</label>
                    <div class="layui-input-block">
                            <input type="text" id="iosVersion" name="iosVersion" lay-verify="required|iosVersion" autocomplete="off"  class="layui-input" th:value="${ m.iosVersion}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><span style="color: red">*</span>IOS下载地址:</label>
                    <div class="layui-input-block">
                            <input type="text" id="iosAddress" name="iosAddress" lay-verify="required|iosAddress" autocomplete="off"  class="layui-input" th:value="${ m.iosAddress}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><span style="color: red">*</span>IOS更新内容:</label>
                    <div class="layui-input-block">
                        <textarea id="iosInfo" name="iosInfo" lay-verify="required|iosInfo"  class="layui-textarea" th:text="${ m.iosInfo}"></textarea>
                    </div>
                </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input type="hidden" name="id" th:value="${ m.id}">
                    <button class="layui-btn" lay-submit="" lay-filter="formSubmit">立即提交</button>
                </div>
            </div>
        </form>
    </div>
</div>

<script>
    layui.use(['layedit', 'layer', 'jquery','liuQi'], function () {
            var form = layui.form,
                liuQi = layui.liuQi,
                laydate = layui.laydate;

            //日期
            form.render();

            //自定义验证规则
            form.verify({
                androidVersion: function (value) {
                },
                androidAddress: function (value) {
                },
                androidInfo: function (value) {
                },
                iosVersion: function (value) {
                },
                iosAddress: function (value) {
                },
                iosInfo: function (value) {
                },
            });
        //监听提交
            form.on('submit(formSubmit)', function (data) {
                data=data.field;
                liuQi.ajax("/admin/version/update",data,
                        function (data) {
                            //关闭
                            parent.layer.msg(data.msg);
                            parent.layui.table.reload('currentTableId');
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                        }
                );
                return false;
            });
        });
</script>

</body>
</html>